<?php
    header( 'Content-type: text/html; charset=iso-8859-1' );
    error_reporting(0);
    include_once("facebook/config.php");
    include_once("php/functions.php");
    
    if($fbuser ==0){
        ?>
        <script>
          var oauth_url = 'https://www.facebook.com/dialog/oauth/';
          oauth_url += '?client_id=<?php echo FACEBOOK_APP_ID;?>';
          oauth_url += '&redirect_uri=' + encodeURIComponent('<?php echo FACEBOOK_APP_PAGE_URL;?>');
          oauth_url += '&scope=publish_stream,email,user_birthday, user_location'
        
          window.top.location = oauth_url;
        </script>
<?php 
    }else{
?>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:fb="https://www.facebook.com/2008/fbml">
    <head>
       
    </head>

    <body style="text-align:center; overflow: hidden;">
    <div id="fb-root"></div>
   <script src="http://connect.facebook.net/en_US/all.js"></script>
        <script>
            window.fbAsyncInit = function() { 
                
            FB.init({
                appId: <?php echo FACEBOOK_APP_ID; ?>, 
                status: true,
                cookie: true,                
                xfbml: true,
                oauth:true
            });
            FB.Canvas.setAutoResize();
            };
            
            
        </script>
        <div class="item" id="bg_contain">
            
        <?php 
            include_once("swf.php");        
        ?>            
        </div>
        
    </body>

</html>
<?php
    }
?>